package com.zyc.socket;

import com.zyc.bean.Hello;
import com.zyc.proxy.RpcClientProxy;
import com.zyc.remoting.transport.RpcRequestTransport;
import com.zyc.remoting.transport.socket.SocketRpcClient;
import com.zyc.service.HelloService;


/**
 * @author zyc
 * @create 2022--05--10 11:29
 */
public class SocketClientMain {
    public static void main(String[] args) {
        // 封装了客户端的socket通信
        RpcRequestTransport socketRpcClient = new SocketRpcClient();

        // 获取代理服务对象
        RpcClientProxy rpcClientProxy = new RpcClientProxy(socketRpcClient);

        HelloService helloServiceProxy = rpcClientProxy.getProxy(HelloService.class);

        // 调用远程方法
        String helloBack = helloServiceProxy.hello(new Hello("你好世界", "来自socket"));
        // 打印结果
        System.out.println(helloBack);

    }

}
